// 笔试强训day32:合唱团

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n = 0, k = 0, d = 0; 
    cin >> n >> k >> d;
    vector<vector<long long>> maxVal(n + 1, vector<long long>(k + 1, 0));
    vector<vector<long long>> minVal(n + 1, vector<long long>(k + 1, 0));
    vector<long long> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        maxVal[i + 1][1] = minVal[i + 1][1] = a[i];
    }

    long long ans = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 2; j <= k; j++)
        {
            for(int m = i - 1; m >= max(i - d, 1); m--)
            {
                maxVal[i][j] = max(maxVal[i][j], max(maxVal[m][j - 1] * a[i - 1], minVal[m][j - 1] * a[i - 1]));
                minVal[i][j] = min(minVal[i][j], min(minVal[m][j - 1] * a[i - 1], maxVal[m][j - 1] * a[i - 1]));
            }
        }
        ans = max(ans, maxVal[i][k]);
    }
    cout << ans << endl;
}